package cn.appinfodb.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.appinfodb.dao.devuser.DevUserMapper;
import cn.appinfodb.pojo.AppCategory;
import cn.appinfodb.pojo.DataDictionary;
import cn.appinfodb.pojo.DevUser;
import cn.appinfodb.pojo.Info;

@Service
public class DevUserServiceImpl implements  DevUserService{
	
	@Resource
	private DevUserMapper devUserMapper;
	
	@Override
	public DevUser login(String devCode, String devPassword) throws Exception {
		// TODO Auto-generated method stub
		DevUser devuser = null;
		devuser = devUserMapper.getLoginUser(devCode);
		//ƥ������
		if(null != devuser){
			if(!devuser.getDevPassword().equals(devPassword))
				devuser = null;
		}
		return devuser;
	}
	@Override
	public List<Info> getInfoList(String querySoftwareName, 
			                     Integer queryStatus, Integer queryFlatfromId,
			                     Integer queryCategoyrLevel, Integer queryCategoyrLeve2, 
			                     Integer queryCategoyrLeve3, Integer queryDevId,
			                     Integer currentPageNo,Integer pageSize) throws Exception
	{
		// TODO Auto-generated method stub
		currentPageNo = (currentPageNo-1)*pageSize;
		return devUserMapper.getInfoList(querySoftwareName, queryStatus,
				                            queryFlatfromId,queryCategoyrLevel,
				                            queryCategoyrLeve2,queryCategoyrLeve3,
				                            queryDevId,
				                            currentPageNo, pageSize);
	}

	@Override
	public int getInfoCount(String querySoftwareName, Integer queryStatus, 
			                Integer queryFlatfromId,Integer queryCategoyrLevel, 
			                Integer queryCategoyrLeve2, Integer queryCategoyrLeve3, 
			                Integer queryDevId)throws Exception
	{
		// TODO Auto-generated method stub
		return devUserMapper.getInfoCount(querySoftwareName, queryStatus,
                                             queryFlatfromId,queryCategoyrLevel,
                                             queryCategoyrLeve2,queryCategoyrLeve3,
                                             queryDevId);
	}
	@Override
	public List<DataDictionary> getDataDictionaryList(String typeCode) throws Exception {
		// TODO Auto-generated method stub
		return devUserMapper.getDataDictionaryList(typeCode);	}
	@Override
	public List<AppCategory> getAppCategoryListByparentId(Integer parentId) throws Exception {
		// TODO Auto-generated method stub
		return devUserMapper.getAppCategoryByparentId(parentId);
	}
	@Override
	public boolean add(Info info) throws Exception {
		// TODO Auto-generated method stub
		boolean flag = false;
		if(devUserMapper.add(info) > 0)
			flag = true;
		return flag;
	}

	

	



	

	

	
}
